package com.example.demo17client;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableOAuth2Client;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

/**
 * @author yawn
 */
@EnableOAuth2Sso
@SpringBootApplication
@RestController
public class Demo17ClientApplication {

	public static void main(String[] args) {
		SpringApplication.run(Demo17ClientApplication.class, args);
	}

	@GetMapping("/hello")
    public String hello(Principal principal) {
        String name = principal.getName();
        return "Hello World with user " + name + " toString: " + principal;
    }
}
